package middleware

import "github.com/kataras/iris/v12"

func AuthConProduct(ctx iris.Context) {
	// 获取cookie
	uid := ctx.GetCookie("uid")
	// 若存在
	if uid == "" {
		//需要先登录
		ctx.Application().Logger().Debug("need to login first!")
		ctx.Redirect("/user/login")
		return 
	}
	ctx.Application().Logger().Debug("already login in")
	ctx.Next()
}